#include "QuadSample.h"
#include "Log.h"
#include "imgui.h"
namespace ShaderLab {
	QuadSample::QuadSample()
	{
		LOGINFO("Create QuadSample.");
	}

	QuadSample::~QuadSample()
	{
		LOGINFO("Destory QuadSample.\n");
	}

	void QuadSample::Init()
	{
		quad = std::make_shared<Quad>(1.0);
		color = glm::vec3(1.0,1.0,0.0);
		mHandle.compileShader("Shaders/quad_vert.glsl");
		mHandle.compileShader("Shaders/quad_frag.glsl");
		mHandle.link();
		mHandle.validate();
		mHandle.printActiveAttribs();
		mHandle.printActiveUniforms();
	}

	void QuadSample::Update(float time)
	{

	}

	void QuadSample::Render()
	{
		mHandle.use();
		mHandle.setUniform("quadColor", color);
		quad->render();
	}

	void QuadSample::Imgui()
	{
		ImGui::ColorEdit3("Quad",&color[0]);
	}

	void QuadSample::ShutDown()
	{

	}
}